package com.springboot.crawler.config;

import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter4;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConverters;
import org.springframework.context.annotation.Bean;

/**
 * Created by dongfangchao on 2017/6/1/0001.
 */
@EnableAutoConfiguration
public class BaseConfig {

    @Bean
    public HttpMessageConverters fastJsonHttpMessageConverter4(){
        FastJsonHttpMessageConverter4 converter4 = new FastJsonHttpMessageConverter4();

        FastJsonConfig fastJsonConfig = new FastJsonConfig();
        fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat);
        converter4.setFastJsonConfig(fastJsonConfig);

        return new HttpMessageConverters(converter4);
    }

}
